import Mock from 'mockjs'

function getPastSevenDays() {
    const dates = [];
    const today = new Date();

    for (let i = 7; i > 0; i--) {
        const pastDate = new Date(today);
        pastDate.setDate(today.getDate() - i);
        dates.push(pastDate.toISOString().split('T')[0]);
    }

    return dates;
}

const getIncomeData = () => {
    let incomeData = []
    getPastSevenDays().forEach(date => {
        incomeData.push({
            date: date,
            income: Mock.mock('@integer(200,3000)')
        })
    })
    return incomeData
}


export default {
    dataCard: {
        code: 200,
        success: true,
        data: [
            {
                title: '今日收益',
                target: Mock.mock('@integer(1000,2000)'),
                contrast: Mock.mock('@integer(2000,3000)'),
                bgColor: Mock.mock('@color')
            }, {
                title: '当月收益',
                target: Mock.mock('@integer(10000,20000)'),
                contrast: Mock.mock('@integer(30000,35000)'),
                bgColor: Mock.mock('@color'),
                subTitle: '上月'
            }, {
                title: '用户数',
                target: Mock.mock('@integer(50000,51000)'),
                contrast: Mock.mock('@integer(49000,50000)'),
                bgColor: Mock.mock('@color'),
            }, {
                title: '文件数',
                target: Mock.mock('@integer(67000,68000)'),
                contrast: Mock.mock('@integer(66500,67000)'),
                bgColor: Mock.mock('@color'),
            },
        ]
    },
    numberRote: {
        code: 200,
        success: true,
        data: {
            number: Mock.mock('@integer(10000,20000)'),
            total: Mock.mock('@integer(50000,70000)'),
        }
    },
    fileCategories: {
        code: 200,
        success: true,
        data: {
            video: Mock.mock('@integer(10000,100000)'),
            text: Mock.mock('@integer(10000,100000)'),
            other: Mock.mock('@integer(10000,100000)'),
            music: Mock.mock('@integer(10000,100000)'),
            picture: Mock.mock('@integer(10000,100000)'),
            packet: Mock.mock('@integer(10000,100000)'),
        }
    },
    incomeLine: {
        code: 200,
        success: true,
        data: getIncomeData
    },
    topShare: Mock.mock({
        code: 200,
        success: true,
        'data|5': [
            {
                'id|+1': 1,
                'filename': '@word(3, 7).@pick(["txt", "mp4", "avi", "mp3", "zip","md","png","jpg","ppt","doc","xlsx"])',
                'user': '@first',
                'views': '@integer(100000,200000)',
                'filePath': '/@word(3, 7)/@word(1, 10)/@word(1, 20)/@word(3, 15).@pick(["txt", "mp4", "avi", "mp3", "zip","md","png","jpg","ppt","doc","xlsx"])',
                'date': '@datetime'
            }
        ]
    }),
    noticeList: Mock.mock({
        code: 200,
        success: true,
        'data|3': [
            {
                'id|+1': 1,
                'content': '@cparagraph',
                'date': '@datetime'
            }
        ]
    })
}